﻿package com.badibadi.adapter;

import com.badibadi.mytools.Utils;
import com.badibadi.uniclubber.R;

import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;

public class AfterLandingRightSlidingSettingAdapter extends BaseAdapter {

	private int img[] = { R.drawable.b6, R.drawable.key, R.drawable.lock,
			R.drawable.b7, R.drawable.b8, R.drawable.b10,
			R.drawable.gywm, R.drawable.b12, };
	private String[] item;
	private Context context;

	public AfterLandingRightSlidingSettingAdapter(Context ct) {
		context = ct;
		item = new String[] { context.getResources().getString(R.string.ClearTheCache), context.getResources().getString(R.string.l_xb150),context.getResources().getString(R.string.l_xb151), context.getResources().getString(R.string.l_xb152), context.getResources().getString(R.string.l_xb153),
				context.getResources().getString(R.string.l_xb155), context.getResources().getString(R.string.l_xb156),context.getResources().getString(R.string.l_xb157)};
	}

	@Override
	public int getCount() {
		// TODO Auto-generated method stub
		return item.length;
	}

	@Override
	public Object getItem(int position) {
		// TODO Auto-generated method stub
		return item[position];
	}

	@Override
	public long getItemId(int position) {
		// TODO Auto-generated method stub
		return position;
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		// TODO Auto-generated method stub
		// LayoutInflater layoutInflater;
		// layoutInflater = LayoutInflater.from(context);
		// convertView=layoutInflater.inflate(R.layout.before_landing_and_regirstration,null);

		LayoutInflater inflater=LayoutInflater.from(context);
		
		convertView=inflater.inflate(R.layout.yinsisetting_adapter, null);
		TextView news=(TextView)convertView.findViewById(R.id.news);
		
		ImageView head=(ImageView)convertView.findViewById(R.id.head);
		TextView nickName=(TextView)convertView.findViewById(R.id.nickName);
		nickName.setText(item[position]);
		head.setImageResource(img[position]);
		if(Utils.isGenXin(context) && position==3)
		{
			news.setVisibility(View.VISIBLE);
		}
		
//		LinearLayout l3 = new LinearLayout(context);
//		LinearLayout l4 = new LinearLayout(context);
//		// LinearLayout l5 = new LinearLayout(context);
//		ImageView iv3 = new ImageView(context);
//		TextView tv3 = new TextView(context);
//		iv3.setImageResource(img[position]);
//		iv3.setPadding(20, 10, 10, 10);
//		tv3.setText(item[position]);
//		tv3.setPadding(10, 10, 10, 10);
//		l3.addView(iv3);
//		l3.addView(tv3);
//		// 设置weight
//		l4.setLayoutParams(new LinearLayout.LayoutParams(
//				LinearLayout.LayoutParams.WRAP_CONTENT,
//				LinearLayout.LayoutParams.WRAP_CONTENT, 1.0f));
//		// l5.setBackgroundResource(R.drawable.youjiantou_bg);
//
//		
//		
//		
//		
//		l3.addView(l4);
//		// l3.addView(l5);
//		l3.setGravity(Gravity.CENTER_VERTICAL);

		return convertView;
	}

}
